package com.csy.rabbit.admin.controller;

import com.csy.rabbit.admin.dto.AdminLoginDTO;
import com.csy.rabbit.admin.service.AdminService;
import com.csy.rabbit.commit.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 管理员表 前端控制器
 * </p>
 *
 * @author csy
 * @since 2022-12-08
 */
@RestController
@RequestMapping("/admin")
public class AdminController {
    @Autowired
    private AdminService adminService;

    @PostMapping("/login")
    public Result<String> login(@RequestBody AdminLoginDTO adminLoginDTO){
        String token = adminService.login(adminLoginDTO);
        return Result.success(token);
    }
    @GetMapping("{token}")
    public Result<Boolean> method(@PathVariable String token){
        boolean result = adminService.method(token);
        return Result.success(result);
    }


}
